package com.kede.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.kede.ienum.*;
import com.kede.typehanlder.*;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;

/**
 * 推广类型
 * @TableName sy_leescore_goods
 */
@TableName(value ="sy_leescore_goods")
@Data
public class LeescoreGoodsDomain implements Serializable {
    /**
     * 商品ID
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 分类ID
     */
    @TableField(value = "category_id")
    private Integer categoryId;

    /**
     * 商品标题
     */
    @TableField(value = "name")
    private String name;

    /**
     * 出售模式:0=积分模式,1=货币模式,2=金钱+货币模式
     */
    @TableField(value = "paytype",typeHandler = PayTypeEnumTypeHanlder.class)
    private PayTypeEnum paytype;

    /**
     * 商品类型: 0=实物商品,1=虚拟商品,2=积分
     */
    @TableField(value = "type",typeHandler = GoodTypeEnumTypeHanlder.class)
    private GoodTypeEnum type;

    /**
     * 商品状态:0=删除,1=仓库,2=上架
     */
    @TableField(value = "status",typeHandler = GoodStatusEnumTypeHanlder.class)
    private GoodStatusEnum status;

    /**
     * 商品发布时间
     */
    @TableField(value = "createtime")
    private Integer createtime;

    /**
     * 商品详情
     */
    @TableField(value = "body")
    private String body;

    /**
     * 兑换规则
     */
    @TableField(value = "rule")
    private String rule;

    /**
     * 图片缩略图
     */
    @TableField(value = "thumb")
    private String thumb;

    /**
     * 商品图集
     */
    @TableField(value = "pics")
    private String pics;

    /**
     * 权重排序
     */
    @TableField(value = "weigh")
    private Integer weigh;

    /**
     * 更新时间
     */
    @TableField(value = "updatetime")
    private Integer updatetime;

    /**
     * 商品库存
     */
    @TableField(value = "stock")
    private Integer stock;

    /**
     * 所需积分
     */
    @TableField(value = "scoreprice")
    private BigDecimal scoreprice;

    /**
     * 开放时间
     */
    @TableField(value = "firsttime")
    private Integer firsttime;

    /**
     * 结束时间
     */
    @TableField(value = "lasttime")
    private Integer lasttime;

    /**
     * 价格
     */
    @TableField(value = "money")
    private BigDecimal money;

    /**
     * 已兑换
     */
    @TableField(value = "usenum")
    private Integer usenum;

    /**
     * 推荐:index=首页,hot=热门,recommend=推荐,new=最新
     */
    @TableField(value = "flag",typeHandler = FlagEnumTypeHanlder.class)
    private FlagEnum flag;

    /**
     * 限购数量
     */
    @TableField(value = "max_buy_number")
    private Integer maxBuyNumber;

    /**
     * 商品分销: 0=不开启,1=开启
     */
    @TableField(value = "fenxiao_status",typeHandler = FenxiaoStatusEnumTypeHanlder.class)
    private FenxiaoStatusEnum fenxiaoStatus;

    /**
     * 运费
     */
    @TableField(value = "express_price")
    private BigDecimal expressPrice;

    /**
     * 来源渠道/领取方式 1线上  2线下
     */
    @TableField(value = "source_channel",typeHandler = SourceChannelEnumTypeHanlder.class)
    private SourceChannelEnum sourceChannel;

    /**
     * 展示标记
     */
//    @TableField("show_tag")
//    private Integer showTag;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        LeescoreGoodsDomain other = (LeescoreGoodsDomain) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getCategoryId() == null ? other.getCategoryId() == null : this.getCategoryId().equals(other.getCategoryId()))
            && (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
            && (this.getPaytype() == null ? other.getPaytype() == null : this.getPaytype().equals(other.getPaytype()))
            && (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
            && (this.getCreatetime() == null ? other.getCreatetime() == null : this.getCreatetime().equals(other.getCreatetime()))
            && (this.getBody() == null ? other.getBody() == null : this.getBody().equals(other.getBody()))
            && (this.getRule() == null ? other.getRule() == null : this.getRule().equals(other.getRule()))
            && (this.getThumb() == null ? other.getThumb() == null : this.getThumb().equals(other.getThumb()))
            && (this.getPics() == null ? other.getPics() == null : this.getPics().equals(other.getPics()))
            && (this.getWeigh() == null ? other.getWeigh() == null : this.getWeigh().equals(other.getWeigh()))
            && (this.getUpdatetime() == null ? other.getUpdatetime() == null : this.getUpdatetime().equals(other.getUpdatetime()))
            && (this.getStock() == null ? other.getStock() == null : this.getStock().equals(other.getStock()))
            && (this.getScoreprice() == null ? other.getScoreprice() == null : this.getScoreprice().equals(other.getScoreprice()))
            && (this.getFirsttime() == null ? other.getFirsttime() == null : this.getFirsttime().equals(other.getFirsttime()))
            && (this.getLasttime() == null ? other.getLasttime() == null : this.getLasttime().equals(other.getLasttime()))
            && (this.getMoney() == null ? other.getMoney() == null : this.getMoney().equals(other.getMoney()))
            && (this.getUsenum() == null ? other.getUsenum() == null : this.getUsenum().equals(other.getUsenum()))
            && (this.getFlag() == null ? other.getFlag() == null : this.getFlag().equals(other.getFlag()))
            && (this.getMaxBuyNumber() == null ? other.getMaxBuyNumber() == null : this.getMaxBuyNumber().equals(other.getMaxBuyNumber()))
            && (this.getFenxiaoStatus() == null ? other.getFenxiaoStatus() == null : this.getFenxiaoStatus().equals(other.getFenxiaoStatus()))
            && (this.getExpressPrice() == null ? other.getExpressPrice() == null : this.getExpressPrice().equals(other.getExpressPrice()))
            && (this.getSourceChannel() == null ? other.getSourceChannel() == null : this.getSourceChannel().equals(other.getSourceChannel()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getCategoryId() == null) ? 0 : getCategoryId().hashCode());
        result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
        result = prime * result + ((getPaytype() == null) ? 0 : getPaytype().hashCode());
        result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        result = prime * result + ((getCreatetime() == null) ? 0 : getCreatetime().hashCode());
        result = prime * result + ((getBody() == null) ? 0 : getBody().hashCode());
        result = prime * result + ((getRule() == null) ? 0 : getRule().hashCode());
        result = prime * result + ((getThumb() == null) ? 0 : getThumb().hashCode());
        result = prime * result + ((getPics() == null) ? 0 : getPics().hashCode());
        result = prime * result + ((getWeigh() == null) ? 0 : getWeigh().hashCode());
        result = prime * result + ((getUpdatetime() == null) ? 0 : getUpdatetime().hashCode());
        result = prime * result + ((getStock() == null) ? 0 : getStock().hashCode());
        result = prime * result + ((getScoreprice() == null) ? 0 : getScoreprice().hashCode());
        result = prime * result + ((getFirsttime() == null) ? 0 : getFirsttime().hashCode());
        result = prime * result + ((getLasttime() == null) ? 0 : getLasttime().hashCode());
        result = prime * result + ((getMoney() == null) ? 0 : getMoney().hashCode());
        result = prime * result + ((getUsenum() == null) ? 0 : getUsenum().hashCode());
        result = prime * result + ((getFlag() == null) ? 0 : getFlag().hashCode());
        result = prime * result + ((getMaxBuyNumber() == null) ? 0 : getMaxBuyNumber().hashCode());
        result = prime * result + ((getFenxiaoStatus() == null) ? 0 : getFenxiaoStatus().hashCode());
        result = prime * result + ((getExpressPrice() == null) ? 0 : getExpressPrice().hashCode());
        result = prime * result + ((getSourceChannel() == null) ? 0 : getSourceChannel().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", categoryId=").append(categoryId);
        sb.append(", name=").append(name);
        sb.append(", paytype=").append(paytype);
        sb.append(", type=").append(type);
        sb.append(", status=").append(status);
        sb.append(", createtime=").append(createtime);
        sb.append(", body=").append(body);
        sb.append(", rule=").append(rule);
        sb.append(", thumb=").append(thumb);
        sb.append(", pics=").append(pics);
        sb.append(", weigh=").append(weigh);
        sb.append(", updatetime=").append(updatetime);
        sb.append(", stock=").append(stock);
        sb.append(", scoreprice=").append(scoreprice);
        sb.append(", firsttime=").append(firsttime);
        sb.append(", lasttime=").append(lasttime);
        sb.append(", money=").append(money);
        sb.append(", usenum=").append(usenum);
        sb.append(", flag=").append(flag);
        sb.append(", maxBuyNumber=").append(maxBuyNumber);
        sb.append(", fenxiaoStatus=").append(fenxiaoStatus);
        sb.append(", expressPrice=").append(expressPrice);
        sb.append(", sourceChannel=").append(sourceChannel);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}